local filelog = require"filelog"
local msghelper = require "tablehelper"
local cardtool = require "cardtool"
require "pszenum"
require "cardvalue"

local RoomSeatLogic = {}

function RoomSeatLogic.init(seatobj, index)
	seatobj.index = index
	seatobj.state = ESeatState.SEAT_STATE_NO_PLAYER
	seatobj.is_tuoguan = EBOOL.FALSE
	return true
end

function RoomSeatLogic.clear(seatobj)
	seatobj.rid = 0
	seatobj.state = 0  --改坐位玩家状态
	seatobj.playerinfo = {}
	seatobj.playgamecount = nil
end

function RoomSeatLogic.is_empty(seatobj)
	return (seatobj.state == ESeatState.SEAT_STATE_NO_PLAYER)
end

function RoomSeatLogic.dealcards(seatobj)
	--把牌发给玩家
	local seatstatusntc = {
		rid = seatobj.rid,
		seat_index = seatobj.index,
		seat_status = seatobj.state,
		seecards = seatobj.seecards
	}

	if (seatobj.seecards or 0) > 0 then
		seatstatusntc.cards = seatobj.cards
	end
	msghelper:sendmsg_to_tableplayer(seatobj, "seatstatusN", seatstatusntc)
end

return RoomSeatLogic